package org.jeecg.modules.zcgl.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.zcgl.entity.AssetInfo;
import org.jeecg.modules.zcgl.vo.AssetLedgerVo;
import org.jeecg.modules.zcgl.vo.statistical.AssetsParameterVo;
import org.jeecg.modules.zcgl.vo.statistical.AssetsParameterStatisticalVo;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Description: 资产信息
 * @Author: jeecg-boot
 * @Date:   2020-06-19
 * @Version: V1.0
 */
public interface AssetInfoMapper extends BaseMapper<AssetInfo> {

    IPage<AssetLedgerVo> queryAssetLedgerVoList(Page<AssetLedgerVo> page, @Param("ew") QueryWrapper<AssetLedgerVo> queryWrapper);

    List<AssetLedgerVo> queryAssetLedgerVoList(@Param("ew") QueryWrapper<AssetLedgerVo> queryWrapper);

    BigDecimal queryTotalAreaByIds(@Param("ids") String ids);

    IPage<AssetsParameterVo> queryAssetsParameterVoList(Page<AssetsParameterVo> page,@Param("ew")  QueryWrapper<AssetsParameterVo> queryWrapper);

    List<AssetsParameterVo> queryAssetsParameterVoList(@Param("ew") QueryWrapper<AssetsParameterVo> queryWrapper);


    /**
     * 通过合同编号查询
     * @param contractNum
     * @return
     */
    @Select("select * from zcgl_asset_info where id in (select asset_id from zcgl_lease_contract_info where contract_num=#{contractNum}) limit 1")
    AssetInfo getByContractNum(String contractNum);

    /**
     * 资产台账汇总
     * @param page
     * @param queryWrapper
     * @return
     */
    @SqlParser(filter = true)
    IPage<AssetsParameterStatisticalVo> queryAssetsParameterStatisticalPageList(Page<AssetsParameterStatisticalVo> page, @Param("ew") QueryWrapper<AssetsParameterStatisticalVo> queryWrapper);
}
